<?php

use app\models\Admins;
use lithium\security\Password;

Admins::applyFilter('save', function($self, $params, $chain) {
    if ($params['data']) {
        $params['entity']->set($params['data']);
        $params['data'] = array();
    }
	$params['entity']->password = Password::hash($params['entity']->password);
    return $chain->next($self, $params, $chain);
});
?>